import React from 'react';
var NavLink = require('./NavLink')

class Playlist extends React.Component{
    render(){
        var arr=[];
        var dd={};

        $.ajax({
            url: 'http://10.31.160.51/react/data.php',
            type: 'get',
            async:false,
            dataType: 'json',
            success:function(data){
                console.log(data)
                dd = data[2];
            }
        })
        console.log(dd)
        for(var i=0;i<dd.length;i++){
            if(i<70){
            arr.push(
                    <li>
                    <div className="u-cover u-cover-1">
                        <img className="j-flag" src={dd[i].img}/>
                        <NavLink title={dd[i].title} to={dd[i].p_id} className="msk"></NavLink>
                    <div className="bottom">
                        <a className="icon-play f-fr" title="播放" href="javascript:;" data-res-type="13" data-res-id="497015710" data-res-action="play"></a>
                        <span className="icon-headset"></span>
                        <span className="nb">{dd[i].numb}</span>
                    </div>
                </div>
                <p className="dec">
                    <a title="【Hip-Hop】采样的魅力：入门系列" href="/playlist?id=497015710" className="tit f-thide s-fc0">{dd[i].title}</a>
                </p>
                <p><span className="s-fc4">{dd[i].by}</span> <a title="泰迪它三岁" href="/user/home?id=105846608" className="nm nm-icn f-thide s-fc3"></a> </p>
                </li>
                );

            };
        };
        return(
            <div className="g-bd" id="m-disc-pl-c">
                <div className="g-wrap p-pl f-pr">
                    <div className="u-title f-cb">
                        <h3><span className="f-ff2 d-flag">全部</span><a href="javascript:;" className="u-btn2 u-btn2-1 menu d-flag" id="cateToggleLink"><i>选择分类<em className="u-icn u-icn-38"></em></i></a></h3>
                        <div className="u-btn f-fr u-btn-hot d-flag">
                            <a href="/discover/playlist/?order=hot&amp;cat=%E5%85%A8%E9%83%A8" className="a1" data-order="hot">热门</a>
                            <a href="/discover/playlist/?order=new&amp;cat=%E5%85%A8%E9%83%A8" className="a2" data-order="new">最新</a>
                        </div>
                    </div>
                    <ul className="m-cvrlst f-cb" id="m-pl-container">
                        {arr}
                    </ul>
                </div>
            </div>
        )
    }
}

module.exports= Playlist;